import { Component, Emit, Prop } from 'vue-facing-decorator'
import Render from '@/render/Render'
import toNative from '@/utils/toNative'
import RenderItem from '../RenderItem'
import Icon from '@/assets/operation/cxbd.png'
import renderModal, { getModelValue, type FormModalDto } from '@/components/modal/Modal'
import DialogRevokeList from './DialogRevokeList'
// import DialogSalaryStatus from './DialogSalaryStatus'

@Component
export class RevokeInsranceOrder extends Render {
    showDialog = false

    basicFormConfig = this.initBasicFormConfig() as FormModalDto
    initBasicFormConfig() {
        return {
            title: '撤销保单',
            width: '400px',
            theme: 'light',
            show: false,
            params: {
                confirmText: '搜索',
            },
            items: {
                companyName: {
                    name: '客户名称',
                    element: 'input',
                    required: true
                }
            },
            complete: async () => {
                // const data = getModelValue(this.basicFormConfig)
                this.showDialog = true
                // console.log(123, data)
                // this.basicFormConfig.show = false
            },
            cancel: () => {
            },
            init: () => {
                // initModelValue(this.basicFormConfig)
            }
        } as FormModalDto
    }

    onShow() {
        this.basicFormConfig.show = true
    }
    render() {
        return (
            <>
                <RenderItem name="撤销保单" src={Icon} onClick={this.onShow} />
                {renderModal(this.basicFormConfig)}
                <DialogRevokeList v-model:show={this.showDialog} companyName={getModelValue(this.basicFormConfig).companyName}/>
            </>
        )
    }
}

export default toNative<{}, {}>(RevokeInsranceOrder)
